package com.qf.spring.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.MethodMatcher;

import java.lang.reflect.Method;

/**
 * 环绕通知~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
public class TranAdvice2 implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        System.out.println("1111111111");
        System.out.println("1111111111");
        System.out.println("1111111111");
        System.out.println("事务开启了");
        Object proceed = invocation.proceed();
        System.out.println("22222222222");
        System.out.println("22222222222");
        System.out.println("22222222222");
        System.out.println("事务提交了");
        return proceed;
    }
}
